package com.example.demo.dao;

import com.example.demo.entity.Customer;
import com.example.demo.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Repository
public class StudentDaoImpl implements StudentDao {

    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public Student getStudentByName(String name) {
        String sql = "select * from student where name = ?";
        return jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(Student.class),name);
    }

}
